--[[
    room : 房间对象
    room_data : {
        join_time : 加入房间时间

    }
]]

local M = {}

---! 设置房间对象
function M:set_room(room)
    return self:set_temp("room", room)
end

---! 获取房间对象
function M:get_room()
    return self:query_temp("room")
end

---! 获取房间ID
function M:get_room_id()
    local room = self:get_room()
    return room and room:get_id() or 0
end

---! 是否在房间中
function M:is_in_room()
    local room = self:get_room()
    return room and true or false
end

---! 设置加入房间时间
function M:set_join_time(ti)
    return self:set_temp("room_data", "join_time", ti)
end

---! 获取加入房间时间
function M:get_join_time()
    return self:query_temp("room_data", "join_time") or 0
end

---! 清理房间相关数据
function M:clear_room()
    self:delete_temp("room")
    self:delete_temp("room_data")
    if self:is_robot() then
        ROBOT_D:recover_robot(self)
    end
end

F_CHAR_ROOM = M
